package com.zlsy.thread.createthread;

/**
 * @author zhouliang
 * @date 2020/03/17
 **/
public class CreateThreadByRunable implements Runnable {

    @Override
    public void run() {
        String name = Thread.currentThread().getName();
        System.out.println(name + ":通过implements Runnable方式创建线程！");
    }

    public static void main(String[] args) {
        CreateThreadByRunable createThreadByRunable = new CreateThreadByRunable();
        for (int i = 0; i < 2; i++) {
            //多个线程，可以去执行一个逻辑，也可以去执行其他的runable的逻辑
            Thread thread = new Thread(createThreadByRunable);
            thread.start();
        }
    }
}
